home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / xulapp / nsXULAppAPI.h < prev   
Encoding:
C/C++ Source or Header  |  2006-05-08  |  8.9 KB  |  259 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
  2. /* ***** BEGIN LICENSE BLOCK *****
  3.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  4.  *
  5.  * The contents of this file are subject to the Mozilla Public License Version
  6.  * 1.1 (the "License"); you may not use this file except in compliance with
  7.  * the License. You may obtain a copy of the License at
  8.  * http://www.mozilla.org/MPL/
  9.  *
  10.  * Software distributed under the License is distributed on an "AS IS" basis,
  11.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  12.  * for the specific language governing rights and limitations under the
  13.  * License.
  14.  *
  15.  * The Original Code is mozilla.org code.
  16.  *
  17.  * The Initial Developer of the Original Code is
  18.  * Netscape Communications Corporation.
  19.  * Portions created by the Initial Developer are Copyright (C) 2002
  20.  * the Initial Developer. All Rights Reserved.
  21.  *
  22.  * Contributor(s):
  23.  *  Brian Ryner <bryner@brianryner.com>
  24.  *  Benjamin Smedberg <bsmedberg@covad.net>
  25.  *
  26.  * Alternatively, the contents of this file may be used under the terms of
  27.  * either the GNU General Public License Version 2 or later (the "GPL"), or
  28.  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  29.  * in which case the provisions of the GPL or the LGPL are applicable instead
  30.  * of those above. If you wish to allow use of your version of this file only
  31.  * under the terms of either the GPL or the LGPL, and not to allow others to
  32.  * use your version of this file under the terms of the MPL, indicate your
  33.  * decision by deleting the provisions above and replace them with the notice
  34.  * and other provisions required by the GPL or the LGPL. If you do not delete
  35.  * the provisions above, a recipient may use your version of this file under
  36.  * the terms of any one of the MPL, the GPL or the LGPL.
  37.  *
  38.  * ***** END LICENSE BLOCK ***** */
  39.  
  40. #ifndef _nsXULAppAPI_h__
  41. #define _nsXULAppAPI_h__
  42.  
  43. #include "prtypes.h"
  44. #include "nsID.h"
  45. #include "nscore.h"
  46. #include "nsXPCOM.h"
  47.  
  48. // XXXbsmedberg - eventually we're going to freeze the XULAPI
  49. // symbols, and we don't want every consumer to define MOZ_ENABLE_LIBXUL.
  50. // Reverse the logic so that those who aren't using libxul have to do the
  51. // work.
  52. #ifdef MOZ_ENABLE_LIBXUL
  53. #ifdef IMPL_XULAPI
  54. #define XULAPI NS_EXPORT
  55. #else
  56. #define XULAPI NS_IMPORT
  57. #endif
  58. #else
  59. #define XULAPI
  60. #endif
  61.  
  62. /**
  63.  * Application-specific data needed to start the apprunner.
  64.  *
  65.  * @status UNDER_REVIEW - This API is under review to be frozen, but isn't
  66.  *                        frozen yet. Use with caution.
  67.  */
  68. struct nsXREAppData
  69. {
  70.   /**
  71.    * This should be set to sizeof(nsXREAppData). This structure may be
  72.    * extended in future releases, and this ensures that binary compatibility
  73.    * is maintained.
  74.    */
  75.   PRUint32 size;
  76.  
  77.   /**
  78.    * The directory of the application to be run. May be null if the
  79.    * xulrunner and the app are installed into the same directory.
  80.    */
  81.   nsILocalFile* directory;
  82.  
  83.   /**
  84.    * The name of the application vendor. This must be ASCII, and is normally
  85.    * mixed-case, e.g. "Mozilla". Optional (may be null), but highly
  86.    * recommended. Must not be the empty string.
  87.    */
  88.   const char *vendor;
  89.  
  90.   /**
  91.    * The name of the application. This must be ASCII, and is normally
  92.    * mixed-case, e.g. "Firefox". Required (must not be null or an empty
  93.    * string).
  94.    */
  95.   const char *name;
  96.  
  97.   /**
  98.    * The major version, e.g. "0.8.0+". Optional (may be null), but
  99.    * required for advanced application features such as the extension
  100.    * manager and update service. Must not be the empty string.
  101.    */
  102.   const char *version;
  103.  
  104.   /** 
  105.    * The application's build identifier, e.g. "2004051604"
  106.    */
  107.   const char *buildID;
  108.  
  109.   /**
  110.    * The application's UUID. Used by the extension manager to determine
  111.    * compatible extensions. Optional, but required for advanced application
  112.    * features such as the extension manager and update service.
  113.    *
  114.    * This has traditionally been in the form
  115.    * "{AAAAAAAA-BBBB-CCCC-DDDD-EEEEEEEEEEEE}" but for new applications
  116.    * a more readable form is encouraged: "appname@vendor.tld". Only
  117.    * the following characters are allowed: a-z A-Z 0-9 - . @ _ { } *
  118.    */
  119.   const char *ID;
  120.  
  121.   /**
  122.    * The copyright information to print for the -h commandline flag,
  123.    * e.g. "Copyright (c) 2003 mozilla.org".
  124.    */
  125.   const char *copyright;
  126.  
  127.   /**
  128.    * Combination of NS_XRE_ prefixed flags (defined below).
  129.    */
  130.   PRUint32 flags;
  131. };
  132.  
  133. /**
  134.  * Indicates whether or not the profile migrator service may be
  135.  * invoked at startup when creating a profile.
  136.  */
  137. #define NS_XRE_ENABLE_PROFILE_MIGRATOR (1 << 1)
  138.  
  139. /**
  140.  * Indicates whether or not the extension manager service should be
  141.  * initialized at startup.
  142.  */
  143. #define NS_XRE_ENABLE_EXTENSION_MANAGER (1 << 2)
  144.  
  145. /**
  146.  * The contract id for the nsIXULAppInfo service.
  147.  */
  148. #define XULAPPINFO_SERVICE_CONTRACTID \
  149.   "@mozilla.org/xre/app-info;1"
  150.  
  151. /**
  152.  * A directory service key which provides the platform-correct
  153.  * "application data" directory.
  154.  * Windows: Documents and Settings\<User>\Application Data\<Vendor>\<Application>
  155.  * Unix: ~/.<vendor>/<application>
  156.  * Mac: ~/Library/Application Supports/<Application>
  157.  */
  158. #define XRE_USER_APP_DATA_DIR "UAppData"
  159.  
  160. /**
  161.  * A directory service key which provides a list of all enabled extension
  162.  * directories. The list includes compatible platform-specific extension
  163.  * subdirectories.
  164.  *
  165.  * @note The directory list will have no members when the application is
  166.  *       launched in safe mode.
  167.  */
  168. #define XRE_EXTENSIONS_DIR_LIST "XREExtDL"
  169.  
  170. /**
  171.  * A directory service key which provides the executable file used to
  172.  * launch the current process.  This is the same value returned by the
  173.  * XRE_GetBinaryPath function defined below.
  174.  */
  175. #define XRE_EXECUTABLE_FILE "XREExeF"
  176.  
  177. /**
  178.  * Begin an XUL application. Does not return until the user exits the
  179.  * application.
  180.  *
  181.  * @param argc/argv Command-line parameters to pass to the application. These
  182.  *                  are in the "native" character set.
  183.  *
  184.  * @param aAppData  Information about the application to be run.
  185.  *
  186.  * @return         A native result code suitable for returning from main().
  187.  *
  188.  * @note           If the binary is linked against the  standalone XPCOM glue,
  189.  *                 XPCOMGlueStartup() should be called before this method.
  190.  *
  191.  * @note           XXXbsmedberg Nobody uses the glue yet, but there is a
  192.  *                 potential problem: on windows, the standalone glue calls
  193.  *                 SetCurrentDirectory, and relative paths on the command line
  194.  *                 won't be correct.
  195.  */
  196. extern "C" XULAPI int
  197. XRE_main(int argc, char* argv[],
  198.          const nsXREAppData* aAppData);
  199.  
  200. /**
  201.  * Given a path relative to the current working directory (or an absolute
  202.  * path), return an appropriate nsILocalFile object.
  203.  */
  204. extern "C" XULAPI nsresult
  205. XRE_GetFileFromPath(const char *aPath, nsILocalFile* *aResult);
  206.  
  207. /**
  208.  * Get the path of the running application binary and store it in aResult.
  209.  * @param argv0   The value passed as argv[0] of main(). This value is only
  210.  *                used on *nix, and only when other methods of determining
  211.  *                the binary path have failed.
  212.  */
  213. extern "C" XULAPI nsresult
  214. XRE_GetBinaryPath(const char *argv0, nsILocalFile* *aResult);
  215.  
  216. /**
  217.  * Get the static components built in to libxul.
  218.  */
  219. extern "C" XULAPI void
  220. XRE_GetStaticComponents(nsStaticModuleInfo const **aStaticComponents,
  221.                         PRUint32 *aComponentCount);
  222.  
  223. /**
  224.  * Initialize libXUL for embedding purposes.
  225.  *
  226.  * @param aLibXULDirectory   The directory in which the libXUL shared library
  227.  *                           was found.
  228.  * @param aAppDirectory      The directory in which the application components
  229.  *                           and resources can be found. This will map to
  230.  *                           the "resource:app" directory service key.
  231.  * @param aAppDirProvider    A directory provider for the application. This
  232.  *                           provider will be aggregated by a libxul provider
  233.  *                           which will provide the base required GRE keys.
  234.  * @param aStaticComponents  Static components provided by the embedding
  235.  *                           application. This should *not* include the
  236.  *                           components from XRE_GetStaticComponents. May be
  237.  *                           null if there are no static components.
  238.  * @param aStaticComponentCount the number of static components in
  239.  *                           aStaticComponents
  240.  *
  241.  * @note This function must be called from the "main" thread.
  242.  *
  243.  * @note At the present time, this function may only be called once in
  244.  * a given process. Use XRE_TermEmbedding to clean up and free
  245.  * resources allocated by XRE_InitEmbedding.
  246.  */
  247.  
  248. extern "C" XULAPI nsresult
  249. XRE_InitEmbedding(nsILocalFile *aLibXULDirectory,
  250.                   nsILocalFile *aAppDirectory,
  251.                   nsIDirectoryServiceProvider *aAppDirProvider = nsnull,
  252.                   nsStaticModuleInfo const *aStaticComponents = nsnull,
  253.                   PRUint32 aStaticComponentCount = 0);
  254.  
  255. extern "C" XULAPI void
  256. XRE_TermEmbedding();
  257.  
  258. #endif // _nsXULAppAPI_h__
  259.